﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="http://1stjs.googlecode.com/svn/trunk/fw4/" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>F.pager演示</title>
<style type="text/css">
html,body,table{font-size:15px;}
.st{background-color : orange;}
.ust{background-color:;}
</style>
<script type="text/javascript" src="1st.js"></script>
</head>
<body>
<div id="statusBar"></div>
<div id="listbox" style="margin:20px 0px;"></div>
<div style="clear:both;" id="pagebox"></div>

<script type="text/javascript">
function up(){
	F.get(url, {act:"gettaobao", size:pager.size, page:pager.page}).call2json(function(o){
		pager.up(o.num);
		F("listbox").html(getHTML(o.data));
	});
}

function getHTML(a){
	var startIdx = (pager.page-1) * pager.size + 1;
	var html = "<tr>\
		<th>序号</th>\
		<th>商品名</th>\
		<th>价格</th>\
		<th>运费</th>\
		<th>地区</th>\
		<th>店铺</th>\
	</tr>";
	for(var i=0,l=a.length; i<l; i++){
		html += '<tr>\
			<td>'+(startIdx+i)+'</td>\
			<td>'+a[i].goods_name+'</td>\
			<td>'+a[i].goods_price+'</td>\
			<td>'+a[i].ship_fee+'</td>\
			<td>'+a[i].shop_region+'</td>\
			<td>'+a[i].shop_name+'</td>\
		</tr>';
	}
	html = '<table border="1"><caption><h3>安卓手机精选</h3></caption>'+html+'</table>';
	return html;
}

var url = F.data("data.php");
var pager = F.pager("pagebox",up).setsize(15);
up();
</script>
</body>
</html>